home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 0669.ZIP / DBPASSWD.DOC < prev    next >
Text File  |  1985-12-30  |  4KB  |  79 lines

  1. The short programs included here will enable you to design applications
  2. that include a system-use log and password-protected entry to the
  3. system.  The password-protection scheme is a simple one - it allows
  4. individuals to log on to a system, and tracks the amount of time the
  5. individual spends logged on.  Several relatively easy modifications can
  6. be made to include information about projects being worked on (if
  7. you were using this for client billing, for example), or, by assigning
  8. acess levels to each user, to restrict access to various levels of a
  9. multi-level program.  The dBase III TIME() function can also be
  10. manipulated to allow you to calculate elapsed time on the system (for
  11. those who don't want to calculate it themselves).
  12.  
  13. If a greater level of security is required for your application, these
  14. programs allow for encryption/decryption of passwords so that the
  15. database containing user names does not contain the actual password.
  16. Unfortunately, dBASE III doesn't lend itself very well to security, so
  17. the method is by no means foolproof, but it should suffice to prevent
  18. accidental discovery of passwords.  If the application is compiled
  19. using either Clipper or Wordtech's DBIII Compiler, the security would
  20. be vastly improved.
  21.  
  22. The method of password encryption is not tremendously sophisticated,
  23. but it works, and unless you read the .PRG file it would take a while
  24. to break it.  The encoding key is the length of the password.  After
  25. the password is entered, the word is parsed through a DO WHILE loop,
  26. and each character's ASCII value is incremented by a value equal to the
  27. length of the password.  This new ASCII value is then converted back to
  28. a letter or character, and concatenated onto the new, encrypted
  29. password.  The decryption module just reverses this process.  You're
  30. welcome to substitute any other method if you're not happy with this
  31. one.
  32.  
  33. Logon and logoff times are entered into a system log database.  This is
  34. the part of the program I left wide open to user modification.  You may
  35. want to add more information to the SYSLOG database; using the dBase
  36. III REPORT commands, you can design a report to extract information in
  37. any format you want.  This database cannot be INDEXed (during logoff,
  38. the program assumes that the last record in the file is the current
  39. record, which won't work if the file is INDEXed), so you will have to
  40. either set up a SORT, or modify the program to allow INDEXing on the
  41. field you are interested in.
  42.  
  43. There are 9 files in this package:
  44.  
  45. 1. DBPASSWD.DOC - This file.
  46. 2. SETPASS.PRG  - Command file which creates user-name/password pairs.
  47. 3. LOGON.PRG    - Command file for verifying user-name/password, and 
  48.                   allowing user to access the system.
  49. 4. ENCRYPT.PRG  - Procedure to encrypt password.
  50. 5. DECRYPT.PRG  - Procedure to decrypt password.
  51. 6. MAINMENU.PRG - Sample menu program for demonstration purposes.
  52. 7. LOGON.DBF    - Database file to store user-name/password pairs.
  53. 8. LOGON.NDX    - Index file for LOGON.DBF - keyed to user-name.
  54. 9. SYSLOG.DBF   - System-use database.
  55.  
  56. The first program that must be run is SETPASS.  This allows you to
  57. create user-name/password pairs.  User-name is limited to 15
  58. characters; passwords must be 10 characters or less.  SETPASS includes
  59. a call to ENCRYPT, which will store an encrypted password in the LOGON
  60. database.  If encryption isn't wanted, the call can be stripped out of
  61. the program without making any other changes.
  62.  
  63. Once passwords have been created, you can use LOGON to access the
  64. system you're protecting.  LOGON includes a call to DECRYPT, which will
  65. decode the encrypted password.  If you've stripped out the encrypting
  66. procedure, you'd better strip out DECRYPT also, or the program will go
  67. down in flames.  Again, the call can be stripped out without any other
  68. changes.
  69.  
  70. LOGON allows three shots at the password.  After the third unsuccessful
  71. attempt, the user is dumped out of dBase to the system prompt. If there
  72. is a successful logon, the user, date, and time are recorded in the
  73. SYSLOG database.  Assuming the user exits the program correctly, the
  74. logoff time will also be recorded.
  75.  
  76. SYSLOG can be examined either by LISTing the file or by creating a
  77. report.  One final note: I wrote the command files using my own
  78. preference in screen color.  You may want to modify the SET COLOR
  79. lines.